<template>
  <div class="msgBox">
    <el-container>
      <el-aside width="184px">
        <h2>我的消息</h2>
        <ul>
          <li>
            <router-link
              to="/msg/at"
              class="index0"
              :class="{'light':cutIndex==0}"
            >
              <i class="iconfont icon1"></i>
              <span>我的</span>
              <span class="count">2</span>
            </router-link>
          </li>
          <li>
            <router-link
              to="/msg/private"
              class="index0"
              :class="{'light':cutIndex==1}"
            >
              <i class="iconfont icon2"></i>
              <span>私信</span>
              <span class="count">2</span>
            </router-link>
          </li>
          <li>
            <router-link
              to="/msg/comment"
              class="index0"
              :class="{'light':cutIndex==2}"
            >
              <i class="iconfont icon3"></i>
              <span>评论</span>
              <span class="count">2</span>
            </router-link>
          </li>
          <li>
            <router-link
              to="/msg/notify"
              class="index0"
              :class="{'light':cutIndex==3}"
            >
              <i class="iconfont icon4"></i>
              <span>通知</span>
              <span class="count">2</span>
            </router-link>
          </li>
        </ul>
        <div class="allRead">一键已读</div>
      </el-aside>
      <el-main>
        <h3
          class="tit"
          v-if="cutIndex===0"
        >@我的</h3>
        <div
          class="priv"
          v-else-if="cutIndex===1"
        >
          <h3 class="tit">私信</h3>
          <a
            href="#"
            class="send"
          >发送私信</a>
        </div>

        <h3
          class="tit"
          v-else-if="cutIndex===2"
        >评论</h3>
        <h3
          class="tit"
          v-else-if="cutIndex===3"
        >通知</h3>
        <router-view></router-view>
      </el-main>
    </el-container>
  </div>

</template>

<script>
export default {
  data () {
    return {
      cutIndex: 1
    }
  },
  watch: {
    '$route.path': function (newVal, oldVal) {
      if (newVal === '/msg/at') {
        this.cutIndex = 0
      } else if (newVal === '/msg/private') {
        this.cutIndex = 1
      }
      else if (newVal === '/msg/comment') {
        this.cutIndex = 2
      }
      else if (newVal === '/msg/notify') {
        this.cutIndex = 3
      }
    }
  },
  created () {
  },
  methods: {
  }
}
</script>

<style lang="less" scoped>
.light {
  background-color: #fff;
}
.msgBox {
  width: 980px;
  min-height: 700px;
  margin: 0 auto;
  border: 1px solid #d3d3d3;
  border-width: 0 1px;
  .el-container {
    min-height: 700px;
    .el-aside {
      h2 {
        height: 30px;
        padding: 32px 0 14px 40px;
        font-size: 20px;
        font-weight: normal;
        line-height: 30px;
      }
      ul {
        border-top: 1px solid #ddd;
        li {
          width: 184px;
          border-bottom: 1px solid #ddd;
          a {
            display: block;
            width: 144px;
            height: 53px;
            padding-left: 40px;
            background: #f7f7f7;
            border-top: 1px solid #fff;
            line-height: 53px;
            display: flex;
            justify-content: left;
            align-items: center;
            .iconfont {
              display: inline-block;
              width: 22px;
              height: 21px;
              background-image: url(../../assets/image/icon.png);
              background-position: -63px -164px;
            }
            .icon2 {
              background-position: -63px -193px;
            }
            .icon3 {
              background-position: -63px -245px;
            }
            .icon4 {
              background-position: -58px -400px;
            }
            span {
              margin: 0 8px 0 6px;
              font-size: 12px;
            }
            .count {
              margin: 0;
              display: inline-block;
              width: 20px;
              height: 20px;
              // padding: 5px;
              border-radius: 10px;
              background-color: red;
              text-align: center;
              line-height: 20px;
              color: #fff;
            }
          }
          a:hover {
            background-color: #fff;
          }
        }
      }
      .allRead {
        width: 112px;
        height: 28px;
        line-height: 28px;
        border: 1px solid rgba(0, 0, 0, 0.2);
        border-radius: 15px;
        text-align: center;
        margin: 20px auto 0;
        font-size: 12px;
        color: rgba(0, 0, 0, 0.8);
        cursor: pointer;
      }
    }
    .el-main {
      padding: 0;
      border-left: 1px solid #666;
      padding: 40px;
      .tit {
        height: 25px;
        border-bottom: 2px solid #d13030;
        font-size: 14px;
      }
      .send {
        // float: right;
        display: inline-block;
        width: 89px;
        height: 31px;
        color: #333;
        background-image: url(../../assets/image/button.png);
        background-position: 0 -680px;
        text-indent: 31px;
        line-height: 30px;
        font-size: 12px;
        position: absolute;
        right: 5px;
        bottom: 4px;
        // border: 1px solid #666;
      }
      .priv {
        position: relative;
        // display: flex;
        // justify-content: space-between;
        // align-items: center;
      }
    }
  }
}
</style>
